package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressBookMapper {
    void insert(AddressBook addressBook);
@Select("select *from address_book where user_id=#{currentId}")
    List<AddressBook> select(Long currentId);
@Select("select *from address_book where id=#{id}")
    AddressBook findById(Long id);

    void update(AddressBook addressBook);
    void updateIsDefaultByUserId(AddressBook addressBook);
@Select("select *from address_book where user_id=#{currentId} and is_default=1")
    AddressBook findDefault(Long currentId);
@Delete("delete from address_book where id=#{id}")
    void deleteById(Long id);
}
